package account.hystrix;

import account.OrderFeign;
import feign.hystrix.FallbackFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import pojo.Account;
import pojo.AccountAndOrder;
import pojo.Order;

import java.util.List;

/**
 * Created by TD on 2021/12/31
 */
@Component
public class OrderFeignFallbackFactory implements FallbackFactory<OrderFeign> {
    @Override
    public OrderFeign create(Throwable throwable) {
        return new OrderFeign() {
            @Override
            public List<Order> insertOrder(Long accountId, String commodityCode, Long count, Long money) {
                String message = throwable.getMessage();
                System.out.println(message);
                return null;
            }

            @Override
            public Order getOrder(Order order, Long account) {
                return null;
            }

            @Override
            public List<Order> id(String id) {
                return null;
            }

            @Override
            public Order addOrder(Order order) {
                return null;
            }

            @Override
            public Order addOrderAnd(AccountAndOrder accountAndOrder) {
                return null;
            }



            @Override
            public List<Order> noParam(List<Long> list) {
                return null;
            }

            @Override
            public ResponseEntity<byte[]> download(String filePath) {
                return null;
            }

            @Override
            public Object springUpload(MultipartFile file) {
                String message = throwable.getMessage();
                System.out.println(message);
                return throwable;
            }


        };
    }
}
